|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectPicture
public class Picture
This class allows you to view and edit pictures.
Constructor Summary | |
---|---|
Picture()
Constructs a blank picture. |
Method Summary | |
---|---|
void |
border(int width)
Adds a black border to the image. |
Color |
getColorAt(int x,
int y)
Gets the color of a pixel. |
int |
getHeight()
Gets the height of this picture. |
int |
getWidth()
Gets the width of this picture. |
void |
load(String source)
Loads a picture from a given source. |
void |
move(int dx,
int dy)
Moves this picture by the given amount in x- and y-direction. |
void |
pick()
Displays a file chooser for picking a picture. |
void |
reload()
Reloads this picture, undoing any manipulations. |
void |
scale(int newWidth,
int newHeight)
Scales this picture to a new size. |
void |
setColorAt(int x,
int y,
Color c)
Sets the color of a pixel. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Picture()
Method Detail |
---|
public int getWidth()
public int getHeight()
public void load(String source)
source
- the image source. If the source starts
with http://, it is a URL, otherwise, a filename.public void reload()
public void pick()
public void move(int dx, int dy)
dx
- the offset in the x-directiondy
- the offset in the y-directionpublic void scale(int newWidth, int newHeight)
newWidth
- the new width of the picturenewHeight
- the new height of the picturepublic void border(int width)
width
- the border widthpublic Color getColorAt(int x, int y)
x
- the column index (between 0 and getWidth() - 1)y
- the row index (between 0 and getHeight() - 1)
public void setColorAt(int x, int y, Color c)
x
- the column index (between 0 and getWidth() - 1)y
- the row index (between 0 and getHeight() - 1)c
- the color for the pixel at position (x, y)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |